#include "Runner.h"


namespace TL {
    Runner::Runner(bool init_run)
    {
        InitializeCriticalSection(&m_LockObject);

        m_Running = init_run;
    }
    Runner::~Runner()
    {
        DeleteCriticalSection(&m_LockObject);
    }

    bool Runner::IsRunning() const
    {
        bool return_value;

        EnterCriticalSection(&m_LockObject);
        {
            return_value = m_Running;
        }
        LeaveCriticalSection(&m_LockObject);

        return return_value;
    }
    void Runner::Start()
    {
        EnterCriticalSection(&m_LockObject);
        {
            m_Running = true;
        }
        LeaveCriticalSection(&m_LockObject);
    }
    void Runner::Stop()
    {
        EnterCriticalSection(&m_LockObject);
        {
            m_Running = false;
        }
        LeaveCriticalSection(&m_LockObject);
    }
}
